package cn.itsource.ymcc.media;

import cn.itsource.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component //component和泛型 一定要加上
public class MediaFileClientFallbackFactory implements FallbackFactory<MediaFileClient> {
    @Override
    public MediaFileClient create(Throwable throwable) {
        return new MediaFileClient(){
            @Override
            public JSONResult listByCourseId(Long courseId) {
                throwable.printStackTrace();
                return JSONResult.error("媒体中心 listByCourseId 接口调用失败"+throwable.getMessage());
            }
        };
    }
}
